<?php


namespace App\Transformers\User;

use App\Models\UserGroup;
use League\Fractal\TransformerAbstract;

class UserGroupsTransformer extends TransformerAbstract
{
    public function transform(UserGroup $userGroup)
    {
        return [
            'id' => $userGroup->id,
            'group_name' => $userGroup->group_name ?? '',
            'created_at' => $userGroup->created_at ? $userGroup->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $userGroup->updated_at ? $userGroup->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
